home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / wb / czesc_3 / newdeftool / source / ndt101.s < prev    next >
Text File  |  1992-04-15  |  93KB  |  2,185 lines

  1.                     OPT l-,c+,d-,a+,o+
  2.  
  3. ;****************************************************************************
  4. ;*                                                                          *
  5. ;* NewDefaultTool V1.01 by Kjell Cederfeldt               91-Aug-03         *
  6. ;*                                                                          *
  7. ;* Copyright (C) by Kjell Cederfeldt 1992. All rights reserved.        /\   *
  8. ;*                                                                    / /   *
  9. ;* Change Default tool in a project icon.                        /\  / /    *
  10. ;*                                                               \ \/ /     *
  11. ;* Written in  DevPac assembler on an A3000.                      \/ /      *
  12. ;*                                                                 \/       *
  13. ;*  Kjell Cederfeldt           Phone  +46 (0)31 - 306334 home               *
  14. ;*  Hammarkulletorget 39              +46 (0)31 - 139316 office             *
  15. ;*  S-442 37  ANGERED   SWEDEN        +46 (0)31 - 306310 support BBS        *
  16. ;*                                                                          *
  17. ;*  UseNet ...{uunet|pyramid|rutgers}!cbmvax!cbmehq!cbmswe!datac!kjell      *
  18. ;*                                                                          *
  19. ;****************************************************************************
  20.  
  21.  
  22.                    include        2:Offset/Offsets.i
  23.                    include        2:Base.i
  24.                    incdir "2:20_include/"                     ;where to look
  25.                    include        exec/ports.i
  26.                    include        intuition/intuition.i
  27.                    include        libraries/dos_lib.i       ;and DOS
  28.                    include        libraries/dos.i
  29.                    include        dos/dosextens.i
  30.                    include        libraries/asl.i
  31.                    include        workbench/startup.i
  32.                    include        workbench/workbench.i
  33.  
  34.  
  35. MEMF_TYPE          =      $10001
  36. MEMF_PUBLIC        =      $0000001
  37. MTYPE_CHIP         =      $0000002                    ; Memory type bits
  38. MEMF_CLEAR         =      $0010000
  39. MEMF_ANY_CLEAR     =      $10000
  40.  
  41. ;                   move.w #0,$dff180    ;TEST! FLASH THE SCREEN!! NOTE! DEBUG ONLY.
  42.  
  43. DEBUG = 0   ;(0=Nej ingen debug (ingen appiocn i CLI-mode)  1=Ja Debug (Appicon i CLI-mode))
  44. *******************************************************************************
  45. ******                             ********************************************
  46. ******    START OF MAIN PROGRAM    ********************************************
  47. ******                             ********************************************
  48. *******************************************************************************
  49.  
  50.                    INIT_AMIGA
  51.  
  52. Start:
  53.                    lea     DosName,a1
  54.                    bsr     OpenLib                    ;Open Doslibrary
  55.                    move.l  d0,DosBase                 ;Save Dosbase
  56.                    beq     Cleanup                    ;Error on open. Exit
  57.  
  58.                    lea     IconName,a1                ;get icon text string
  59.                    bsr     OpenLib                    ;Open Iconlibrary
  60.                    move.l  d0,IconBase                ;Save Iconbase
  61.                    beq     Cleanup                    ;Error in open. Exit
  62.  
  63.                    lea     IntName(pc),a1             ;get 'intuition.library'
  64.                    bsr     OpenLib                    ;Open intuitionlibrary
  65.                    move.l  d0,IntBase                 ;svae intuitionbase
  66.                    beq     Cleanup                    ;Error in open Exit.
  67.  
  68.                    lea     WBName(pc),a1              ;get 'workbench.library'
  69.                    bsr     OpenLib                    ;Open Workbenchlibrary
  70.                    move.l  d0,WBBase                  ;svae Workbenchbase
  71.                    beq     Cleanup                    ;Error in open Exit.
  72.  
  73.                    bsr     PointTOCLI                 ;get our cli
  74.                    bsr     ScreenMSG                  ;print text to CLI-window
  75.  
  76.                            * Alloc memory for selected icons witch will be changed.
  77.  
  78.                    move.l  #1024,d0                   ;request 1024 bytes of mem
  79.                    bsr     AllocMem                   ;AllocMem
  80.                    move.l  d0,FileMem                 ;save pointer to our mem
  81.  
  82.                            * Alloc memory for fileinfoblock we get from examine (configuration file)
  83. MoreAlloc
  84.                    move.l  #260,d0                    ;request 260 bytes of mem
  85.                    bsr     AllocMem                   ;AllocMem
  86.                    move.l  d0,FileInfoMem             ;save pointer to our mem
  87.  
  88.                            * Alloc memory for newdeftool string
  89.  
  90.                                                       ;note 255 in loop MutchPattern:
  91.                    move.l  #256,d0                    ;request 256 bytes of mem
  92.                    bsr     AllocMem                   ;AllocMem
  93.                    move.l  d0,NewDefTool              ;save pointer to our mem
  94.  
  95.                            * Alloc memory for copydeftool string
  96.  
  97.                    move.l  #515,d0                    ;request 515 bytes of mem
  98.                    bsr     AllocMem                   ;AllocMem
  99.                    move.l  d0,CopyDefTool             ;save pointer to our mem
  100.  
  101.                    bsr     OpenCfgFile                ;Open and read configfile.
  102.                    cmp.l   #0,RetCode1                ;RetCode=NULL error in Cfg-file.
  103.                    beq     Cleanup
  104.  
  105. CheckCLIArgs  ;Args from CLI!
  106.  
  107.                    IFEQ    DEBUG
  108.                    cmp.l   #1,(WBTRUE).l              ;Check if start from WB or CLI
  109.                    beq.s   NOTStartFromCLI            ;no start from CLI
  110.                                                       ;Check args from CLI!
  111.                    move.w  #0,APPICONTRUE             ;Forget AppIcons flag (Set to untrue)
  112. NOTStartFromCLI
  113.                    ENDC
  114. ArgListloop
  115.                    move.l  ArgList(pc),a1             ;get adress to arguments
  116.                    cmp.b   #0,(a1)                    ;have we some arg?
  117.                    beq.s   CheckAppArgs               ;no!
  118.  
  119.                    move.w  #0,APPICONTRUE             ;Forget AppIcons flag (Set to untrue)
  120.                    bsr     GetCLIArg                  ;Get Arguments from CLI
  121.                    tst.l   d0
  122.                    beq     EXIT                       ;no more entrys.
  123.                    bsr     HandleFile
  124.                    cmp.w   #1,CLIMORE
  125.                    beq.s   ArgListloop
  126.                    bra     EXIT
  127.  
  128. CheckAppArgs   ;Args from AppIcon/Window
  129.  
  130.                    cmp.w   #1,APPICONTRUE             ;Check if AppIcon in cfg-file!
  131.                    bne     CheckAslArgs           ;nix no AppIcon
  132.  
  133. *****************************************************************
  134. ;Check in we already have our messageport in system, if so, we have
  135. ;a sleeping copy of this program as a task already.
  136. ;Send message to sleeping task to wakeup. (Show the window).
  137.  
  138.             ; Already in use? We will not run another copy of this program.
  139.  
  140.                    move.l  (ExecBase).w,a6            ;Execbase
  141.                    lea     PortName(pc),a1            ;get our portname.
  142.                    jsr     _FindPort(a6)              ;try to find our port
  143.                    tst.l   d0                         ;found it?
  144.                    beq.s   NoMsgPort                  ;No! countinue.
  145.                    move.l  d0,FoundPort               ;yes save the pointer to port were the
  146.                                                       ;message will go.
  147.  
  148.                    move.l  TaskAdr,a4                 ;find our userport were the reply
  149.                    lea     pr_MsgPort(a4),a0          ;will go!
  150.                    move.l  a0,MyPort                  ;save pointer to the replyport.
  151.  
  152.                    moveq.l #86,d0                     ;request 86 bytes of mem for AppMessagestructure
  153.                    bsr     AllocMem                   ;AllocMem
  154.                    move.l  d0,AppMsgStruct            ;save pointer to our mem
  155.                    move.l  d0,a1
  156.  
  157.                    move.l  MyPort,MN_REPLYPORT(a1)    ;set replyport
  158.                    move.w  #86,MN_LENGTH(a1)
  159.                    move.b  #NT_MESSAGE,LN_TYPE(a1)    ;set type of message
  160.                    move.l  #64,am_UserData(a1)
  161.                    move.l  #1,am_ID(a1)
  162.                    move.l  FoundPort,a0               ;get port to send message.
  163.  
  164.                    move.l  (ExecBase).w,a6            ;Execbase
  165.                    jsr     _PutMsg(a6)                ;send the message to the sleeping task
  166.  
  167.                    move.l  MyPort(pc),a0
  168.                    jsr     _WaitPort(a6)              ;hämta meddelande
  169.  
  170.                    move.l  MyPort(pc),a0
  171.                    jsr     _GetMsg(a6)                ;hämta meddelande
  172.  
  173.                    move.l  AppMsgStruct(pc),a1        ;get pointer to alloced mem.
  174.                    moveq.l #86,d0                     ;equal to alloced bytes of mem!
  175.                    bsr     FreeMem                    ;FreeMem
  176.  
  177.                    move.l  #0,MyPort                  ;Clear label so Cleanuprutin no try to remove som ports
  178.                    bra.s   Cleanup                     ;and den terminate!
  179.  
  180. NoMsgPort
  181.  
  182. *****************************************************************
  183.  
  184.                    bsr     GetAPPArg
  185.                    tst.l   d0
  186.                    beq.s   CheckAslArgs           ;no more entrys.
  187.                    bra.s   EXIT
  188.  
  189.  
  190. CheckAslArgs  ;Args from Asl-filerequester
  191.  
  192.                    bsr     GetASLArg
  193.                    bsr     HandleFile
  194. ;                   bra.s   EXIT
  195.  
  196.  
  197. EXIT                                                  ;here the main program ends
  198.  
  199. ****************************************************************************
  200. ****************************************************************************
  201. *********                                  *********************************
  202. *********    CLEANUP  AND  EXIT  PROGRAM   *********************************
  203. *********                                  *********************************
  204. ****************************************************************************
  205. ****************************************************************************
  206.  
  207. Cleanup
  208.                    cmp.w   #1,APPICONTRUE
  209.                    bne.s   Cleanup1
  210.                    bsr     RemAppIcon                 ;remove AppIcon
  211.  
  212. Cleanup1
  213.                    move.l  MyPort(pc),d0              ;get our port
  214.                    beq.s   Cleanup2                   ;created ?
  215.                    bsr     DeletePort                 ;yes! then remove it.
  216. Cleanup2
  217.                    move.l  NewDefTool(pc),a1          ;get pointer to alloced mem.
  218.                    move.l  #256,d0                    ;equal to alloced bytes of mem!
  219.                    bsr     FreeMem                    ;FreeMem
  220.  
  221.                    move.l  CopyDefTool(pc),a1         ;get pointer to alloced mem.
  222.                    move.l  #515,d0                    ;equal to alloced bytes of mem!
  223.                    bsr     FreeMem                    ;FreeMem
  224.  
  225.                    move.l  ConfigMem(pc),a1           ;get pointer to alloced mem.
  226.                    move.l  FileLen,d0                 ;equal to alloced bytes of mem!
  227.                    bsr     FreeMem                    ;FreeMem
  228.  
  229.                    move.l  EntryMem(pc),a1            ;get pointer to alloced mem.
  230.                    move.l  ENTRYS,d0                  ;equal to alloced bytes of mem!
  231.                    mulu    #31,d0
  232.                    bsr     FreeMem                    ;FreeMem
  233.  
  234.                    move.l  FileInfoMem(pc),a1         ;get pointer to alloced mem.
  235.                    move.l  #260,d0                    ;equal to alloced bytes of mem!
  236.                    bsr     FreeMem                    ;FreeMem
  237.  
  238.                    move.l  FileMem(pc),a1             ;get pointer to alloced mem.
  239.                    move.l  #1024,d0                   ;equal to alloced bytes of mem!
  240.                    bsr     FreeMem                    ;FreeMem
  241. Cleanup3
  242.                    move.l  (ExecBase).w,a6
  243.                    move.l  IconBase(pc),a1            ;get iconbase
  244.                    cmp.l   #0,a1                      ;have we any iconbase
  245.                    beq.s   Cleanup4                   ;no!
  246.                    jsr     _CloseLibrary(a6)          ;yes close Doslibrary
  247. Cleanup4
  248.                    move.l  (ExecBase).w,a6
  249.                    move.l  WBBase(pc),a1              ;get Workbench base
  250.                    cmp.l   #0,a1                      ;have we any iconbase
  251.                    beq.s   Cleanup5                   ;no!
  252.                    jsr     _CloseLibrary(a6)          ;yes close Doslibrary
  253. Cleanup5
  254.                    move.l  (ExecBase).w,a6            ;
  255.                    move.l  AslBase(pc),a1             ;get ASlbase
  256.                    cmp.l   #0,a1                      ;have we any ASlbase?
  257.                    beq.s   Cleanup6                   ;no!
  258.                    jsr     _CloseLibrary(a6)          ;yes close ASLlibrary
  259. Cleanup6
  260.                    move.l  (ExecBase).w,a6            ;
  261.                    move.l  IntBase(pc),a1             ;get Intbase
  262.                    cmp.l   #0,a1                      ;have we any Intbase?
  263.                    beq.s   Cleanup7                   ;no!
  264.                    jsr     _CloseLibrary(a6)          ;yes close Intlibrary
  265. Cleanup7
  266.                    move.l  (ExecBase).w,a6
  267.                    move.l  DosBase(pc),a1             ;get Dosbase
  268.                    cmp.l   #0,a1                      ;have we any dosbase?
  269.                    beq.s   Cleanup8                   ;no!
  270.                    jsr     _CloseLibrary(a6)          ;yes close Doslibrary:
  271. Cleanup8
  272.                    EXIT_AMIGA
  273.  
  274. CFGName1:          dc.b    's:'
  275. CFGName2:          dc.b    'NewDefTool.cfg',0
  276.                    even
  277.  
  278. *****************************************************************************
  279. *****************************************************************************
  280. *****************************************************************************
  281. *****************************************************************************
  282. *****                         ********                            ***********
  283. *****   END OF MAIN PROGRAM   ********   SUBRUTINS BEGINS HERE    ***********
  284. *****                         ********                            ***********
  285. *****************************************************************************
  286. *****************************************************************************
  287. *****************************************************************************
  288. *****************************************************************************
  289.  
  290.  
  291. ************************************************************************
  292. *****                 **************************************************
  293. *****    HandleFile   **************************************************
  294. *****                 **************************************************
  295. ************************************************************************
  296.  
  297. ; This routine handles file (include path) in alloced FileMem (The 
  298. ; selected file).  IF the file is a directory then all files in the
  299. ; directory will be scanned and changed if match with config-file.
  300.  
  301.  
  302. HandleFile:
  303.  
  304.                    bsr     CheckFileDir               ;test if argument is a file or
  305.                    cmp.l   #0,RetCode1                ;a direktory.
  306.                    bne.s   HandleFileCount
  307.                    bra.s   EndHandleFile
  308.  
  309. HandleFileCount
  310.  
  311.                    cmp.l   #0,DirEntryType
  312.                    blt.s   SingleFILE                 ;the path was a file
  313.  
  314.                    bsr     ScanDir                    ;read in all entrys in directory
  315.  
  316. DirEntryLoop
  317.                    bsr     FindNextFile               ;find nextfile in dir
  318.                    tst.l   d0
  319.                    beq.s   Ending                     ;no more entrys.
  320. SingleFILE
  321.                    bsr     FixINFO                    ;mask .info if exists in filename
  322.  
  323.                    bsr     GetDefTool                 ;get default tool from icon.
  324.                    tst.l   d0                         ;get default from project-icon?
  325.                    beq.s   EndOfFinds                 ;No! Don't do any thing.
  326.  
  327.                    bsr     FindNewDefToolFF           ;find replace tool via namelist
  328.                    cmp.w   #1,MatchOK                 ;have we a match? if no try toollist
  329.                    beq.s   EndOfFinds
  330.                    bsr     FindNewDefTool             ;find replace tool and change if found!
  331. EndOfFinds
  332.                    bsr     FreeDiskObj                ;free the poor icon (free diskobject)
  333. NoProjectChange
  334.  
  335.                    cmp.l   #0,DirEntryType            ;are we in an direcory?
  336.                    bgt.s   DirEntryLoop               ;yes try next icon
  337. Ending
  338.                    bsr     UnLockFileDir              ;unlock the lock on file or dir
  339.  
  340.                    cmp.l   #0,DirEntryType            ;are we in an directory?
  341.                    blt.s   EndHandleFile              ;no! end this funktion.
  342.  
  343.                    move.l  DosBase(pc),a6             ;get DOS base
  344.                    move.l  OldLock,d1                 ;get the filelock
  345.                    jsr     _CurrentDir(a6)            ;get back to old CD!
  346.  
  347. EndHandleFile
  348.                    rts
  349.  
  350.  
  351. *****************************************************************************
  352. *****                      **************************************************
  353. *****    REPLY MESSAGE     **************************************************
  354. *****                      **************************************************
  355. *****************************************************************************
  356.  
  357. ReplyMSG
  358.  
  359.                    move.l  (ExecBase).w,a6            ;basadress till EXEC i a6
  360.                    move.l  NewMessage(pc),d0          ;hämta meddeladet
  361.                    beq.s   EndReplyMSG               ;inget meddelande att besvara.
  362.                    move.l  d0,a1
  363.                    jsr     _ReplyMsg(a6)              ;besvara meddelandet
  364.                    move.l  #0,NewMessage              ;nolla gammalt meddelande
  365. EndReplyMSG
  366.                    rts
  367.  
  368. *****************************************************************************
  369. *****                         ***********************************************
  370. *****    OPEN LIBRARY         ***********************************************
  371. *****                         ***********************************************
  372. *****************************************************************************
  373.  
  374. OpenLib
  375.                    moveq   #37,d0
  376.                    move.l  (ExecBase).w,a6
  377.                    jsr     _OpenLibrary(a6)
  378.                    rts
  379.  
  380. *****************************************************************************
  381. *****                         ***********************************************
  382. *****    ALLOC/FREE MEMORY    ***********************************************
  383. *****                         ***********************************************
  384. *****************************************************************************
  385.  
  386. AllocMem     ;INPUTS -> d0=MemSize
  387.  
  388.                    move.l  (ExecBase).w,a6
  389.                    move.l  #MEMF_ANY_CLEAR,d1         ;any type of mem.
  390.                    jsr     _AllocMem(a6)              ;AllocMem
  391.                    tst.l   d0
  392.                    beq.s   AllocError                 ;no errors, count.
  393.                    rts
  394.  
  395.              ; OUTPUTS  <- d0 location of memoryblock.
  396.  
  397. AllocError
  398.                    bsr     NoMemMSG                   ;print text to CLI-window
  399.                    bra     Cleanup                    ;no memory. Exit
  400.  
  401. ;****  Freememory ****
  402.  
  403. ;                  INPUTS -> a1=pointer to memory block
  404. ;                         -> d0=MemSize in bytes
  405. FreeMem
  406.                    move.l  (ExecBase).w,a6            ;Exec base
  407.                    cmp.l   #0,a1
  408.                    beq.s   NoAlloc
  409.                    jsr     _FreeMem(a6)               ;FreeMem
  410. NoAlloc            rts
  411.  
  412. **************************************************************************
  413. **********                            ************************************
  414. **********    GET ARGUMENTS FROM CLI  ************************************
  415. **********                            ************************************
  416. **************************************************************************
  417.  
  418. GetCLIArg
  419.                    moveq.l #0,d0
  420.                    move.l  ArgList(pc),a1             ;get pointer to cli arguments
  421. GetCLIArgStart
  422.                    cmp.b   #' ',(a1)                  ;start of argument?
  423.                    bne.s   ReadCliArg
  424.                    cmp.b   #0,(a1)                    ;NULL found?start of argument?
  425.                    beq     CliArgError
  426.                    addq.l  #1,a1
  427.                    move.l  a1,(ArgList).l
  428.                    bra.s    GetCLIArg
  429.  
  430. ReadCliArg
  431.                    cmp.b   #'-',(a1)                  ;have we some switch?
  432.                    beq     ArgSwitch                  ;yes read them!
  433.  
  434.                    cmp.b   #'?',(a1)                  ;have we some switch?
  435.                    beq     CliHelp                    ;yes read them!
  436.  
  437. ReadCLIArg
  438.  
  439.                    move.l  FileMem(pc),a0             ;get pointer to alloced mem
  440.                    move.l  ArgList(pc),a1             ;get pointer to cli arguments
  441.                    move.w  #0,CLIMORE
  442.  
  443. CLIReadPathLoop
  444.                    move.b  (a1),(a0)                  ;Move from arglist to filemem
  445.                    beq.s   ReadCliEnd                 ;end of arguments?
  446.                    cmp.b   #34,(a1)
  447.                    beq.s   CliFnutt
  448.                    cmp.b   #' ',(a1)                  ;end of this argument
  449.                    beq.s   ReadCliTempEnd
  450.                    addq.l  #1,a0
  451.                    addq.l  #1,a1
  452.                    bra.s   CLIReadPathLoop
  453.  
  454. CliFnutt
  455.                    addq.l  #1,a1
  456. CliFnuttLoop
  457.                    move.b  (a1),(a0)                  ;Move from arglist to filemem
  458.                    beq     CliArgError2
  459.                    cmp.b   #34,(a1)
  460.                    beq.s   EndCliFnutt
  461.                    addq.l  #1,a0
  462.                    addq.l  #1,a1
  463.                    bra.s   CliFnuttLoop
  464. EndCliFnutt
  465.                    addq.l  #1,a1
  466.                    cmp.b   #0,(a1)
  467.                    beq.s   ReadCliEnd
  468.                    cmp.b   #' ',(a1)
  469.                    bne.s   CliArgError2
  470. ReadCliTempEnd                                        ;end of filename not arguments
  471.                    addq.l  #1,a1
  472.                    cmp.b   #' ',(a1)
  473.                    beq.s   ReadCliTempEnd
  474.                    move.l  a1,(ArgList).l
  475.                    cmp.b   #0,(a1)
  476.                    beq.s   ReadCliEnd
  477.                    move.w  #1,CLIMORE
  478.  
  479. ReadCliEnd                                            ;end of filename and arguments
  480.                    move.b  #0,(a0)                    ;always null terminate string
  481.  
  482. ;**************************
  483.  
  484.                    move.l  DosBase(pc),a6
  485.                    move.l  FileMem(pc),d1             ;get pointer to alloced mem
  486.                    moveq.l #ACCESS_READ,d2            ;lock for read
  487.                    jsr     _Lock(a6)
  488.                    tst.l   d0
  489.                    beq.s   CliArgError2
  490.                    move.l  d0,d6
  491.                    move.l  d6,d1
  492.                    move.l  FileMem(pc),d2             ;get pointer to alloced mem
  493.                    move.l  #1024,d3
  494.                    jsr     _NameFromLock(a6)
  495.                    move.l  d6,d1
  496.                    jsr     _UnLock(a6)
  497.  
  498.                    moveq.l #1,d0                      ;set funktion successful.
  499. ArgErrFile
  500.                    rts
  501.  
  502. ArgSwitch
  503.                    addq.l  #1,a1
  504.                    cmp.b   #'h',(a1)
  505.                    beq.s   CliHelp                    ;yes
  506.                    cmp.b   #'?',(a1)
  507.                    beq.s   CliHelp                    ;yes
  508.  
  509. ;                   bra.s   CliArgError
  510.  
  511. CliArgError
  512.                    bsr     ErrorMSG                   ;yes
  513.                    moveq.l #0,d0                      ;set funktion unsuccessful.
  514.                    rts
  515.  
  516. CliArgError2
  517.                    bsr     Error2MSG                  ;yes
  518.                    moveq.l #0,d0                      ;set funktion unsuccessful.
  519.                    rts
  520.  
  521. CliHelp
  522.                    bsr     HelpMSG                    ;yes
  523.                    moveq.l #0,d0                      ;set funktion unsuccessful.
  524.                    rts
  525.  
  526. **************************************************************************
  527. **********                               *********************************
  528. **********    APPICON/WINDOW ARGUMENTS   *********************************
  529. **********                               *********************************
  530. **************************************************************************
  531.  
  532. GetAPPArg
  533.                    bsr     CreatePort                 ;Yes create port
  534.                    tst.l   d0
  535.                    beq     Cleanup                    ;Error Cleanup
  536.                    bsr     AddAppIcon                 ;Create AppIcon!
  537.                    cmp.l   #0,d0
  538.                    beq     AppIconNotFound
  539.                    move.l  MyPort(pc),a0
  540.                    moveq   #1,d2
  541.                    moveq   #0,d1
  542.                    move.b  MP_SIGBIT(a0),d1
  543.                    lsl.l   d1,d2
  544.                    move.l  d2,MysigBit
  545.  
  546. AppLoop:
  547.                    move.l  (ExecBase).w,a6             ;basadress till EXEC i a6
  548.                    move.l  MysigBit,d0
  549.                    jsr     _Wait(a6)
  550.  
  551. Mess1
  552.                    move.l  (ExecBase).w,a6            Execbase
  553.                    move.l  MyPort(pc),a0
  554.                    jsr     _GetMsg(a6)                ;hämta meddelande
  555.                    move.l  d0,NewMessage
  556.                    beq.s   AppLoop                       ;ingen händelse
  557.  
  558. HandleAppMsg
  559.                    move.l  NewMessage,a1
  560.                    move.l  am_ID(a1),d1               ;ID# från AppWindow
  561.                    cmp.l   #1,d1
  562.                    bne     AppError
  563.  
  564.                    move.l  am_UserData(a1),d1         ;UserData från AppWindow
  565.                    cmp.l   #64,d1
  566.                    bne     AppError
  567.  
  568.                    move.l  NewMessage,a1
  569.                    move.l  am_NumArgs(a1),d1          ;nuber of argument from AppIcon
  570.                    cmp.l   #0,d1                      ;0=Dubbleclick on AppIcon
  571.                    beq     AppUserWindow
  572.  
  573.                    move.l  d1,d5
  574.                    subq.l  #1,d5
  575.  
  576.                    move.l  NewMessage,a1
  577.                    move.l  am_ArgList(a1),a4          ;Antal argument från AppIcon
  578. WBArgLoop
  579.                    move.l  DosBase(pc),a6             ;get DOS base
  580.                    move.l  wa_Lock(a4),d1             ;Get lock
  581.                    move.l  FileMem,d2
  582.                    move.l  #1024,d3                   ;request 1024 bytes of mem
  583.                    jsr     _NameFromLock(a6)
  584.                    beq.s   EndAppMsg
  585.  
  586.                    move.l  wa_Name(a4),a1             ;Antal argument från AppIcon
  587.                    cmp.b   #0,(a1)
  588.                    beq.s   EndAddAppName
  589.  
  590.                    move.l  FileMem(pc),a3
  591. FindAppPath
  592.                    cmp.b   #0,(a3)+
  593.                    bne.s   FindAppPath
  594.  
  595. EndFindAppPath
  596.                    subq.l  #2,a3
  597.                    cmp.b   #':',(a3)+
  598.                    beq.s   AddAppName
  599.  
  600.                    move.b  #'/',(a3)+
  601. AddAppName
  602.                    move.b  (a1)+,(a3)+
  603.                    bne.s   AddAppName
  604.  
  605. EndAddAppName
  606.  
  607.                    move.l  a4,-(sp)
  608.                    move.l  d5,-(sp)
  609.  
  610.                    bsr     HandleFile
  611.  
  612.                    move.l  EntryMem(pc),a1            ;get pointer to alloced mem.
  613.                    move.l  ENTRYS,d0                  ;equal to alloced bytes of mem!
  614.                    mulu    #31,d0
  615.                    bsr     FreeMem                    ;FreeMem
  616.                    move.l  #0,EntryMem                ;get pointer to alloced mem.
  617.  
  618.                    move.l  (sp)+,d5
  619.                    move.l  (sp)+,a4
  620.  
  621.  
  622.                    addq.l  #8,a4
  623.                    dbra    d5,WBArgLoop
  624.  
  625. EndAppMsg
  626.  
  627.                    bsr     ReplyMSG                   ;reply message
  628.                    bra     AppLoop
  629.  
  630. AppError
  631.                    bsr     ReplyMSG                   ;reply message
  632.                    bsr     DisplayFlash
  633.                    bra     AppLoop
  634. AppQuit
  635.                    bsr     ReplyMSG                   ;reply message
  636.                    moveq.l #1,d0
  637. EndGetAPPArg
  638.                    rts
  639.  
  640. AppIconNotFound
  641.                    bsr     AppErrMSG
  642.                    moveq.l #1,d0
  643.                    rts
  644.  
  645. AppUserWindow
  646.                    bsr     ReplyMSG                   ;rep|y message
  647.                    lea     EASYStruct2,a1
  648.                    bsr     Request
  649.                    cmp     #1,d0
  650.                    beq.s   FuncHide
  651.                    bra.s   FuncQuit
  652.  
  653. FuncHide
  654.                    bsr.s   FuncReply                  ;rep|y message
  655.                    bra     AppLoop
  656.  
  657. FuncQuit
  658.                    bsr.s   FuncReply                  ;rep|y message
  659.                    bra.s   AppQuit
  660.  
  661. FuncReply
  662.                    move.l  (ExecBase).w,a6            ;Execbase
  663.                    move.l  MyPort(pc),a0
  664.                    jsr     _GetMsg(a6)                ;hämta meddelande
  665.                    move.l  d0,NewMessage
  666.                    beq.s   EndFuncReply              ;ingen händelse
  667.                    bsr     ReplyMSG                   ;rep|y message
  668.                    bra.s   FuncReply
  669. EndFuncReply       rts
  670.  
  671.  
  672. **************************************************************************
  673. **********                            ************************************
  674. **********    OPEN FILEREQUESTERS     ************************************
  675. **********                            ************************************
  676. **************************************************************************
  677.  
  678. GetASLArg
  679.                            * ASL FileRequester in OS 2.0
  680.  
  681. OpenASL            lea     AslName(pc),a1
  682.                    bsr     OpenLib                    ;Open Asllibrary
  683.                    move.l  d0,AslBase
  684.                    beq     Cleanup                    ;Error on open.
  685.  
  686.                    move.l  AslBase(pc),a6
  687.                    moveq.l #ASL_FileRequest,d0
  688.                    lea     AslTags(pc),a1
  689.                    jsr     _AllocAslRequest(a6)
  690.                    move.l  d0,FileReq                 ;save handle
  691.                    beq     Cleanup                    ;no handle error, exit
  692.  
  693.                    move.l  FileReq(pc),a0
  694.                    lea     AslTags(pc),a1
  695.                    jsr     _AslRequest(a6)
  696.                    tst.l   d0
  697.                    beq     Cleanup                    ;CANCEL
  698.  
  699.                    move.l  FileReq(pc),a0
  700.  
  701.                    move.l  FileReq(pc),a0             ;get pointer to asl strukture.
  702.                    bsr     BuildPathASL
  703.  
  704.                    move.l  AslBase(pc),a6
  705.                    move.l  FileReq(pc),a0
  706.                    jsr     _FreeFileRequest(a6)
  707. ENDAsl
  708.                    rts
  709.  
  710. AslTags            dc.l    ASL_Hail,titletxt
  711.                    dc.l    ASL_MinHeight,200
  712.                    dc.l    ASL_Height,200
  713.                    dc.l    ASL_Width,302
  714.                    dc.l    ASL_MaxHeight,400
  715.                    dc.l    TAG_DONE
  716.  
  717.  
  718. titletxt           dc.b    'Select icon to retool',0
  719.                    even
  720.  
  721. *****************************************************************************
  722. *******                                           ***************************
  723. *******   CHECK  SELECTED  PATH   DIR OR FILE ?   ***************************
  724. *******                                           ***************************
  725. *****************************************************************************
  726.  
  727. CheckFileDir
  728.  
  729.                    move.l  FileMem,d1                 ;get pointer filename
  730.                    move.l  DosBase(pc),a6             ;get DOS base
  731.                    moveq.l #SHARED_LOCK,d2            ;read only
  732.                    jsr     _Lock(a6)                  ;lock the file
  733.                    move.l  d0,MyFileLock              ;remember the lock
  734.                    tst.l   d0                         ;ok?
  735.                    bne.s   CheckDubbelCheck           ;no
  736.  
  737.                    move.l  #-1,DirEntryType           ;>0 = Dir, <0 = File
  738.                    move.l  #1,RetCode1
  739.                    rts
  740.  
  741. CheckDubbelCheck
  742.  
  743.                    move.l  #0,RetCode1
  744.  
  745.                    move.l  d0,d1
  746.                    move.l  FileInfoMem(pc),d2         ;pointer to FileInfoBlock
  747.                    jsr     _Examine(a6)
  748.                    tst.l   d0                         ;ok?
  749.                    beq.s   UnLockFileDir              ;no
  750.  
  751.                    move.l  #1,RetCode1
  752.  
  753.                    move.l  FileInfoMem(pc),a0         ;address to FileInfoBlock
  754.                    addq.l  #fib_DirEntryType,a0       ;offset to filelen
  755.                    move.l  (a0),DirEntryType          ;>0 = Dir, <0 = File
  756.                    cmp.l   #0,(a0)
  757.                    blt.s   UnLockFileDir              ;bransh if file (unlock if file)
  758.  
  759.                    move.l  MyFileLock,d1              ;get the filelock
  760.                    jsr     _CurrentDir(a6)
  761.                    move.l  d0,OldLock
  762.  
  763. CheckFileDirEnd     rts
  764.  
  765. ******************************************************************************
  766.  
  767. UnLockFileDir
  768.                    cmp.l   #0,MyFileLock              ;have we a lock?
  769.                    beq.s   EndUnLockFileDir           ;no! Do not try to unlock.
  770.                    move.l  DosBase(pc),a6
  771.                    move.l  MyFileLock,d1              ;get filelock
  772.                    jsr     _UnLock(a6)                ;release it
  773.                    move.l  #0,MyFileLock              ;delete filelock-pointer
  774. EndUnLockFileDir   rts
  775.  
  776. ******************************************************************************
  777. ****                        ****                                           ***
  778. ****  SCAN/READ DIRECTORY   ****   ALLOC NEEDED MEMORY FOR ENTRYS IN DIR   ***
  779. ****                        ****                                           ***
  780. ******************************************************************************
  781.  
  782. ScanDir
  783.                    move.l  ENTRYS,d0                  ;get actual numbers of entrys.
  784.                    mulu    #31,d0                     ;mult numbers of character in array
  785.                    bsr     AllocMem                   ;AllocMem
  786.                    move.l  d0,EntryMem                ;save pointer to our mem
  787.                    move.l  EntryMem(pc),a5            ;get pointer arraydata
  788.                    moveq.l #0,d5
  789. FindNextFile2
  790.                    addq.l  #1,d5                      ;add readed entrys
  791.                    cmp.l   ENTRYS,d5                  ;compere with alloced number of entrys
  792.                    bcc.s   AllocMoreEntrys            ;we need to alloc more entrys.
  793.  
  794.                    move.l  MyFileLock,d1              ;get the filelock
  795.                    move.l  FileInfoMem(pc),d2         ;pointer to FileInfoBlock
  796.                    move.l  DosBase(pc),a6             ;get DOS base
  797. FindNextEntry2
  798.                    jsr     _ExNext(a6)                ;get next entry
  799.                    tst.l   d0
  800.                    beq.s   FindNextFileEnd2           ;no more entrys
  801.  
  802.                    move.l  FileInfoMem(pc),a0         ;address to FileInfoBlock
  803.                    addq.l  #fib_DirEntryType,a0       ;offset to filetype
  804.                    cmp.l   #0,(a0)                    ;dir or file?
  805.                    bgt.s   FindNextFile2              ;dir, get next entry
  806.  
  807. InfoFilter
  808.                    move.l  FileInfoMem(pc),a0         ;address to FileInfoBlock
  809.                    addq.l  #fib_FileName,a0           ;offset to filename
  810.                    cmp.b   #0,(a0)
  811.                    beq.s   FindNextFile2              ;emptyname (no name) get next.
  812. FindFilterSTR
  813.                    cmp.b   #0,(a0)+                   ;find NULL-terminate (End of string)
  814.                    bne.s   FindFilterSTR
  815.                    subq.l  #6,a0
  816.                    lea     InfoStr,a1
  817.                    moveq   #0,d0
  818. FilterStrLoop
  819.                    cmp.b   (a0)+,(a1)+                ;look after .info in filename
  820.                    bne.s   FindNextFile2
  821.                    addq    #1,d0
  822.                    cmp.l   #5,d0
  823.                    bne.s   FilterStrLoop              ;not found OK! Keep going
  824.  
  825.                    move.l  FileInfoMem(pc),a0         ;address to FileInfoBlock
  826.                    addq.l  #fib_FileName,a0           ;offset to filename
  827.                    move.l  a5,a1                      ;get start offset in array
  828.                    
  829. MoveNameLoop2
  830.                    cmp.b   #0,(a0)
  831.                    beq.s   MoveNameEnd2
  832.                    move.b  (a0)+,(a1)+
  833.                    bra.s   MoveNameLoop2
  834. MoveNameEnd2
  835.                    move.b  #0,(a1)                    ;dont forget to terminate
  836.                    add.l   #31,a5                     ;next row in array
  837.                    move.b  #0,(a5)
  838.                    bra.s   FindNextFile2
  839.  
  840. FindNextFileEnd2
  841.                    move.l  EntryMem(pc),a5            ;get pointer arraydata
  842.                    rts
  843.  
  844. AllocMoreEntrys
  845.  
  846.                    bsr     UnLockFileDir              ;release filelock from MyFileLock
  847.  
  848.                    move.l  DosBase(pc),a6             ;get DOS base
  849.                    move.l  OldLock,d1                 ;get the filelock
  850.                    jsr     _CurrentDir(a6)            ;back too startdir
  851.  
  852.                    move.l  (ExecBase).w,a6            ;Exec base
  853.                    move.l  EntryMem(pc),a1            ;get pointer to alloced mem.
  854.                    cmp.l   #0,a1
  855.                    beq.s   AllocMoreCont
  856.                    move.l  ENTRYS,d0                  ;equal to alloced bytes of mem!
  857.                    mulu    #31,d0
  858.                    jsr     _FreeMem(a6)               ;FreeMem
  859.                    move.l  #0,EntryMem                ;NULL pointer to alloced mem.
  860. AllocMoreCont
  861.  
  862.                    bsr     CheckFileDir               ;test if argument is a file or
  863. ;                   cmp.l   #0,RetCode1               ;no error checks needs because
  864. ;                   beq     Ending                    ;we already know it alright (just for locks and so)
  865.  
  866.                    move.l  ENTRYS,d0                  ;get actual numbers of entrys.
  867.                    add.l   d0,d0                      ;bubble entrys alloc memory
  868.                    move.l  d0,ENTRYS                  ;save numbers of entrys.
  869.                    bra     ScanDir                    ;start to read again.
  870.  
  871. ENTRYS             dc.l    512                        ; 512 entrys.
  872.  
  873. *******************************************************************************
  874. ********                                   ************************************
  875. ********    FIND NEXT FILE FROM FILE MEM   ************************************
  876. ********                                   ************************************
  877. *******************************************************************************
  878.  
  879. FindNextFile
  880.                    moveq.l #0,d0                      ;null alert funktion
  881.                    move.l  a5,a0                      ;get actual arraydata pointer.
  882.                    move.l  FileMem,a1                 ;get pointer filenamemem
  883.                    cmp.b   #0,(a0)
  884.                    beq.s   FindNextFileEnd
  885. MoveNameLoop
  886.                    cmp.b   #0,(a0)
  887.                    beq.s   MoveNameEnd
  888.                    move.b  (a0)+,(a1)+
  889.                    bra.s   MoveNameLoop
  890. MoveNameEnd
  891.                    move.b  #0,(a1)                    ;dont forget to terminate
  892.                    moveq.l #1,d0                      ;alert funktion is well
  893.                    add.l   #31,a5                     ;add to next entry in array.
  894. FindNextFileEnd
  895.                    rts
  896.  
  897. *****************************************************************************
  898. ****************                       **************************************
  899. ****************   WRITE TEXT STRING   **************************************
  900. ****************                       **************************************
  901. *****************************************************************************
  902.  
  903. NoMemMSG:
  904.                    lea     EasyMEMERRText,a1
  905.                    move.l  a1,EASYText
  906.                    lea     EASYStruct,a1
  907.                    bsr     Request
  908.                    rts
  909.  
  910. *************************************************************
  911. CfgErrMSG:
  912.                    lea     EasyCFGERRText,a1
  913.                    move.l  a1,EASYText
  914.                    lea     EASYStruct,a1
  915.                    bsr     Request
  916.                    move.l  #0,RetCode1
  917.                    rts
  918.  
  919. AppErrMSG:
  920.                    lea     EasyAPPERRText,a1
  921.                    move.l  a1,EASYText
  922.                    lea     EASYStruct,a1
  923.                    bsr     Request
  924.                    rts
  925.  
  926. OpenCfgErrMSG:
  927.                    lea     EasyOpenCFGERRText,a1
  928.                    move.l  a1,EASYText
  929.                    lea     EASYStruct,a1
  930.                    bsr     Request
  931.                    move.l  #0,RetCode1
  932.                    rts
  933.  
  934. ScreenMSG:
  935.                    move.l  #SText1,d2                 ;point to textstring
  936.                    move.l  #SText1E-SText1,d3         ;string length
  937.                    bsr     TextWrite                  ;write string
  938.                    rts
  939.  
  940. HelpMSG:
  941.                    move.l  #HText1,d2                 ;point to textstring
  942.                    move.l  #HText1E-HText1,d3         ;string length
  943.                    bsr.s   TextWrite                  ;write string
  944.                    rts
  945.  
  946. ErrorMSG:
  947.                    move.l  #EText,d2                  ;point to textstring
  948.                    move.l  #ETextE-EText,d3           ;string length
  949.                    bsr.s   TextWrite                  ;write string
  950.                    rts
  951.  
  952. Error2MSG:
  953.                    move.l  #E2Text,d2                 ;point to textstring
  954.                    move.l  #E2TextE-E2Text,d3         ;string length
  955.                    bsr.s   TextWrite                  ;write string
  956.                    rts
  957.  
  958.  
  959. FoundMSG:
  960.                    move.l  #FoundStr,d2               ;point to textstring
  961.                    move.l  #EFoundStr-FoundStr,d3     ;string length
  962.                    bsr.s   TextWrite                  ;write string
  963.                    rts
  964.  
  965. ChangeMSG:
  966.                    move.l  #ChangeStr,d2              ;point to textstring
  967.                    move.l  #EChangeStr-ChangeStr,d3   ;string length
  968.                    bsr.s   TextWrite                  ;write string
  969.                    rts
  970.  
  971. WriteDefTool:
  972.  
  973.                    move.l  Diskobj(pc),a1             ;get diskobj strukture.
  974.                    move.l  do_DefaultTool(a1),a1
  975.  
  976.                    moveq   #0,d3
  977. DirNLen:           cmp.b   #0,(a1)+
  978.                    beq.s   WriteDN
  979.                    addq.l  #1,d3
  980.                    bra.s   DirNLen
  981.  
  982. WriteDN:
  983.                    move.l  Diskobj(pc),a1             ;get diskobj strukture.
  984.                    move.l  do_DefaultTool(a1),a1
  985.                    move.l  a1,d2
  986.                    bsr.s   TextWrite                  ;skriv strängen
  987.                    rts
  988.  
  989.  
  990. WriteFeed
  991.                    move.l  #Feed,d2                   ;pekare till textsträngen
  992.                    moveq.l #1,d3                      ;sträng längd
  993.                    bsr.s   TextWrite                  ;skriv strängen
  994.                    rts
  995.  
  996. *****************************************************************************
  997.  
  998. TextWrite:
  999.                    tst.l   (WBTRUE).l
  1000.                    bne.s   ENDTextWrite
  1001.                    move.l  DosBase(pc),a6
  1002.                    move.l  CLIpoint(pc),d1
  1003.                    jsr     _Write(a6)
  1004. ENDTextWrite
  1005.                    rts
  1006.  
  1007. ******************************************************************************
  1008. **********                           *****************************************
  1009. **********    BUILD PATH FROM ASL    *****************************************
  1010. **********                           *****************************************
  1011. ******************************************************************************
  1012.  
  1013. BuildPathASL
  1014.                    move.l  FileMem(pc),a1             ;get pointer to alloced mem.
  1015.                    move.l  a0,a3
  1016.                    move.l  rf_Dir(a0),a2              ;Path string
  1017.                    cmp.b   #0,(a2)
  1018.                    bne.s   BLDAslPath
  1019.                    subq    #1,a1
  1020.                    bra.s   BuildFileASL
  1021. BLDAslPath
  1022.                    move.b  (a2),(a1)+
  1023.                    cmp.b   #0,(a2)+
  1024.                    bne.s   BLDAslPath
  1025.  
  1026.                    subq.l  #2,a1
  1027.                    cmp.b   #':',(a1)
  1028.                    beq.s   BuildFileASL
  1029.  
  1030.                    addq.l  #1,a1
  1031.                    move.b  #'/',(a1)
  1032.  
  1033. BuildFileASL
  1034.                    addq.l  #1,a1
  1035.                    move.l  a3,a0
  1036.                    move.l  rf_File(a0),a2             ;file string
  1037.                    cmp.b   #0,(a2)
  1038.                    beq.s   EndPathASL
  1039. BLDAslFile
  1040.                    move.b  (a2),(a1)+
  1041.                    cmp.b   #0,(a2)+
  1042.                    bne.s   BLDAslFile
  1043.  
  1044. EndPathASL
  1045.                    rts
  1046.  
  1047. ******************************************************************************
  1048. *************                                               ******************
  1049. *************    FIXINFO / MASK .INFO STRING IN FILENAME    ******************
  1050. *************                                               ******************
  1051. ******************************************************************************
  1052.  
  1053.  
  1054. FixINFO
  1055.                    move.l  FileMem(pc),a1             ;get pointer filename
  1056.                    cmp.b   #0,(a1)
  1057.                    beq     Cleanup
  1058. FindInfoSTR
  1059.                    cmp.b   #0,(a1)+                   ;find NULL-terminate (End of string)
  1060.                    bne.s   FindInfoSTR
  1061.                    subq.l  #6,a1
  1062.                    move.l  a1,a3
  1063.                    lea     InfoStr,a0
  1064.                    moveq   #0,d0
  1065. InfoStrLoop
  1066.                    cmp.b   (a0)+,(a1)+                ;look after .info in filename
  1067.                    bne.s   EndInfoStr
  1068.                    addq    #1,d0
  1069.                    cmp.l   #5,d0
  1070.                    bne.s   InfoStrLoop                ;not found OK! Keep going
  1071.  
  1072.                    move.b  #0,(a3)                    ;Delete .info in filename.
  1073. EndInfoStr
  1074.                    rts
  1075.  
  1076. *****************************************************************************
  1077. **************                                        ***********************
  1078. **************   Get DefaultToolstring from Diskobj.  ***********************
  1079. **************                                        ***********************
  1080. *****************************************************************************
  1081.  
  1082. GetDefTool:
  1083.                    move.l  FileMem(pc),a0             ;get pointer path & filename
  1084.                    move.l  IconBase(pc),a6
  1085.                    jsr     _GetDiskObject(a6)         ;get diskobject
  1086.                    move.l  d0,Diskobj                 ;Save diskobjectet pointer
  1087.                    beq.s   GetDefToolEnd              ;Error!
  1088.  
  1089.                    moveq.l #0,d0
  1090.                    move.l  Diskobj(pc),a1             ;get diskobj strukture.
  1091.                    cmp.b   #4,do_Type(a1)             ;check if project-icon!
  1092.                    bne.s   GetDefToolEnd              ;no! End this funktion.
  1093.  
  1094.                    tst.l   (WBTRUE).l
  1095.                    bne.s   NoDefWrite
  1096.  
  1097.                    bsr     FoundMSG                   ;write foundtext   to CLI
  1098.                    bsr     WriteDefTool               ;write defaulttool to CLI
  1099. NoDefWrite
  1100.                    moveq.l #1,d0
  1101. GetDefToolEnd
  1102.                    rts
  1103.  
  1104. ******************************************************************************
  1105. ******                           ****                          ***************
  1106. ******   Find New Default Tool   ****   CHANGE  DEFAULT TOOL   ***************
  1107. ******                           ****                          ***************
  1108. ******************************************************************************
  1109.  
  1110. *  ;Check first if filename match the configfile
  1111. *
  1112.  
  1113. *
  1114. *   ;a0=configfile a1=string olddefaulttool a2=string filename in cfg-file
  1115. *
  1116. FindNewDefToolFF    ;(FF=FromFile)
  1117.  
  1118.                    move.l  StartOFFiles(pc),a2        ;get pointer config-memory
  1119.                    move.l  CopyDefTool,a3             ;get pointer old default string
  1120.                    move.l  NewDefTool,a4              ;get pointer where put new sting
  1121.  
  1122.                    move.w  #0,MatchOK                 ;reset match remember value.
  1123.  
  1124. MainFindLoopFF
  1125.  
  1126.                    move.l  DosBase(pc),a6
  1127.                    move.l  FileMem(pc),d1             ;get pointer path & filename
  1128.                    jsr     _FilePart(a6)              ;take only filename!
  1129.                    move.l  d0,d6
  1130.  
  1131.                    bsr.s   MatchPattern
  1132.  
  1133.                    cmp.w   #1,MatchOK                 ;have we a match? if no try next row
  1134.                    beq.s   EndFindDefToolFF
  1135.  
  1136. FindNewRowFF
  1137.                    cmp.b   #0,(a2)                    ;end of config-file?
  1138.                    beq.s   EndFindDefToolFF           ;Yes quit.
  1139.  
  1140.                    cmp.l   EndOFFiles,a2              ;End of Files (get from INIT)
  1141.                    bcc.s   EndFindDefToolFF           ;yes, quit.
  1142.  
  1143.                    cmp.b   #10,(a2)+                  ;end of row?
  1144.                    beq.s   MainFindLoopFF             ;yes, make new match-check
  1145.                    bra.s   FindNewRowFF               ;no count.
  1146.  
  1147. EndFindDefToolFF
  1148.                    rts
  1149.  
  1150. *
  1151. *   ;a0=configfile a1=string olddefaulttool a2=string newdeftool
  1152. *
  1153.  
  1154. FindNewDefTool
  1155.  
  1156.                    move.l  StartOFTools(pc),a2        ;get pointer config-memory
  1157.                    move.l  CopyDefTool,a3             ;get pointer old default string
  1158.                    move.l  NewDefTool,a4              ;get pointer where put new sting
  1159.  
  1160.                    move.w  #0,MatchOK                 ;reset match remember value.
  1161.  
  1162. MainFindLoop
  1163.  
  1164.                    move.l  Diskobj(pc),a1             ;get diskobj strukture.
  1165.                    move.l  do_DefaultTool(a1),d6      ;get pointer to old DefTool (matchstring)
  1166.  
  1167.                    bsr.s   MatchPattern
  1168.  
  1169.                    cmp.w   #1,MatchOK                 ;have we a match? if no try next row
  1170.                    beq.s   EndFindDefTool
  1171.  
  1172. FindNewRow
  1173.                    cmp.b   #0,(a2)                    ;end of config-file?
  1174.                    beq.s   EndFindDefTool             ;Yes quit.
  1175.  
  1176.                    cmp.l   EndOFTools,a2              ;End of tools (get from INIT)
  1177.                    bcc.s   EndFindDefTool             ;yes, quit.
  1178.  
  1179.                    cmp.b   #10,(a2)+                  ;end of row?
  1180.                    beq.s   MainFindLoop               ;yes, make new match-check
  1181.                    bra.s   FindNewRow                 ;no count.
  1182.  
  1183. EndFindDefTool
  1184.                    rts
  1185.  
  1186. ************************************************************************
  1187.  
  1188. MatchPattern
  1189.                    move.l  NewDefTool,a0              ;get source-workbuffer for ParsePattern
  1190.                    move.l  CopyDefTool,d2             ;get dest-workbuffer for ParsePattern
  1191.                    move.l  #255,d1
  1192. SourceMatchLoop
  1193.                    move.b  (a2)+,(a0)                 ;Copy to sourcebuffer from configmem and NULL-terminate
  1194.                    cmp.b   #0,(a0)                    ;if end of configmem=Error
  1195.                    beq.s   nomatching
  1196.                    cmp.b   #10,(a0)                   ;if end of-row configmem=Error
  1197.                    beq     CFGInitError2              ;error in config file. Quit
  1198.                    cmp.b   #' ',(a0)                  ;(space) end of sourcestring?
  1199.                    beq.s    EndSourcematchLoop         ;yes!
  1200.                    cmp.b   #9,(a0)                    ;(TAB) end of sourcestring?
  1201.                    beq.s   EndSourcematchLoop         ;yes!
  1202.                    addq.l  #1,a0                      ;Add!
  1203.                    dbra    d1,SourceMatchLoop
  1204.                    bra     CFGInitError2              ;error in config file. Quit
  1205.  
  1206. EndSourcematchLoop
  1207.                    move.b  #0,(a0)                    ;NULL-Terminate
  1208.                    subq.l  #1,a2                      ;back address
  1209.                    move.l  a2,Rememb                  ;remember. we count. from here later.
  1210.  
  1211.                    move.l  NewDefTool,d1              ;get NULL-Terminater sourcebuffer
  1212.                    move.l  #515,d3                    ;Length of bytes in dest-buffer.
  1213.  
  1214.                    move.l  DosBase(pc),a6
  1215.                    jsr     _ParsePatternNoCase(a6)    ;Parse string from Configmem (are there som wildcards)
  1216.  
  1217.                    cmp.l   #-1,d0                     ;error while parsing (0 and 1 is OK!)
  1218.                    beq.s   nomatching
  1219.  
  1220.                    move.l  CopyDefTool,d1             ;Get parsed workbuffer as matchbuffer
  1221.  
  1222.                    move.l  d6,d2
  1223.  
  1224.                    jsr     _MatchPatternNoCase(a6)    ;Match parsed string with string from Icon
  1225.                    bne.s   FindChangeString           ;jump if strings match
  1226. nomatching         rts
  1227.  
  1228. FindChangeString
  1229.  
  1230.                    move.l  Rememb,a2                  ;first space betwin source/dest string
  1231. FindChangeLoop
  1232.                    cmp.b   #' ',(a2)
  1233.                    beq.s   FindChangeCount2
  1234.                    cmp.b   #9,(a2)
  1235.                    beq.s   FindChangeCount2
  1236.                    bra.s   FindChangeCount
  1237. FindChangeCount2
  1238.                    addq.l  #1,a2
  1239.                    bra.s   FindChangeLoop
  1240.  
  1241. FindChangeCount
  1242.  
  1243.                    cmp.b   #0,(a2)
  1244.                    beq     CFGInitError2              ;error in config file. Quit
  1245. ChangeLoop2
  1246.                    move.b  (a2),(a4)
  1247.                    cmp.b   #10,(a2)
  1248.                    beq.s   ChangeStringDone
  1249.                    addq.l  #1,a2
  1250.                    addq.l  #1,a4
  1251.                    bra.s   ChangeLoop2
  1252. ChangeStringDone
  1253.                    move.b  #0,(a4)
  1254.                    bsr.s   PutNewDefTool
  1255.  
  1256.                    move.w  #1,MatchOK                 ;alert an match. No more tryes.
  1257.                    rts
  1258.  
  1259. Rememb             dc.l    0
  1260.  
  1261. **********************************************************************************
  1262.  
  1263. PutNewDefTool
  1264.                    move.l  Diskobj(pc),a1             ;get diskobj strukture.
  1265.                    move.l  NewDefTool,a4              ;get pointer where put new sting
  1266.                    move.l  a4,do_DefaultTool(a1)      ;get pointer to old DefTool
  1267.  
  1268.                    move.l  IconBase(pc),a6
  1269.                    move.l  FileMem(pc),a0             ;get pointer path & filename
  1270.                    move.l  Diskobj,a1
  1271.                    jsr     _PutDiskObject(a6)
  1272.  
  1273.                    bsr     ChangeMSG                  ;write defaulttool to CLI
  1274.                    bsr     WriteDefTool               ;write defaulttool to CLI
  1275.                    bsr     WriteFeed                  ;write defaulttool to CLI
  1276.  
  1277.                    rts
  1278.  
  1279.  
  1280. **********************************************************************************
  1281. **********                                    ************************************
  1282. **********    INIT CONFIGURATION IN MEMORY    ************************************
  1283. **********                                    ************************************
  1284. **********************************************************************************
  1285.  
  1286. INITCONFIG
  1287.  
  1288. FindUserInterface       ;how to request? via AppIcon, AppWindow or filerequest?
  1289.                                                    ; (if no cli-args ?!)
  1290.  
  1291.                    move.l  ConfigMem(pc),a0           ;get pointer config-memory
  1292.                    move.l  a0,EndOFUIface             ;save this if no AppIcon found
  1293. UIface             lea     INTERFACESTRING,a3         ;get pointer to APPICON: string
  1294.  
  1295. UItartTLoop
  1296.                    move.b  (a0),d0
  1297.                    move.b  (a3),d3
  1298.                    cmp.b   d0,d3                      ;A=A?
  1299.                    beq.s   UIStartTool2               ;yes check rest of argument
  1300.  
  1301.                    cmp.b   #0,(a0)+                   ;No! end of config?
  1302.                    bne.s   UItartTLoop                ;no, check if found foward
  1303.  
  1304.                    bra     FindStartTools             ;error in configfile
  1305.  
  1306. UIStartTool2
  1307.                    addq.l  #1,a0
  1308.                    addq.l  #1,a3
  1309.                    cmp.b   #0,(a0)
  1310.                    beq     CFGInitError               ;error in configfile
  1311.  
  1312.                    move.b  (a0),d0
  1313.                    move.b  (a3),d3
  1314.                    cmp.b   d0,d3
  1315.                    bne.s   UIface
  1316.                    cmp.b   #':',(a3)
  1317.                    bne.s   UIStartTool2
  1318.  
  1319. UIEqual
  1320.                    addq.l  #1,a0
  1321.                    cmp.b   #'=',(a0)                  ;find = charcter
  1322.                    beq.s   UIEqualEnd
  1323.                    cmp.b   #' ',(a0)                  ;only space pleace (if not =)
  1324.                    beq.s   UIEqual
  1325.  
  1326.                    bra     CFGInitError               ;error in configfile
  1327.  
  1328. UIEqualEnd
  1329.                    addq.l  #1,a0
  1330.                    cmp.b   #0,(a0)                    ;är file slut?
  1331.                    beq     CFGInitError               ;error in configfile
  1332.  
  1333.                    cmp.b   #' ',(a0)                  ;leta upp början
  1334.                    beq.s   UIEqualEnd
  1335.  
  1336.                    move.l  a0,StartOFUIface           ;här borde iconnamnet (m path)
  1337.                                                       ;i cfg-filen börja.
  1338.  
  1339. FindUITxtEnd
  1340.                    addq.l  #1,a0
  1341.                    cmp.b   #' ',(a0)                  ;leta upp slutet
  1342.                    beq.s   MarkUIFTXTEnd              ;markera slutet av filnamn.
  1343.  
  1344.                    cmp.b   #10,(a0)                   ;leta upp slutet
  1345.                    beq.s   MarkUIFTXTEnd              ;markera slutet av filnamn.
  1346.  
  1347.                    cmp.b   #0,(a0)                    ;leta upp början
  1348.                    beq     CFGInitError               ;error in config file
  1349.  
  1350.                    bra.s   FindUITxtEnd
  1351.  
  1352. MarkUIFTXTEnd
  1353.                    move.b  #0,(a0)                    ;NULL terminate the name.
  1354.                    addq.l  #1,a0
  1355.                    move.l  a0,EndOFUIface             ;end of path
  1356.                    move.w  #1,APPICONTRUE             ;notify AppIcon will be used
  1357.  
  1358. ;********** Find X: = ??? and Y: ???
  1359.  
  1360.                    move.l  EndOFUIface(pc),a0         ;get pointer config-memory
  1361. FindAppXPos        lea     APPX,a3                    ;get pointer to X: string
  1362.  
  1363. AppXPosLoop1
  1364.                    move.b  (a0),d0
  1365.                    move.b  (a3),d3
  1366.                    cmp.b   d0,d3                      ;X=X?
  1367.                    beq.s   AppXPosLoop2               ;yes check rest of argument
  1368.                    cmp.b   #0,(a0)+                   ;No! end of config?
  1369.                    bne.s   AppXPosLoop1               ;no, check if found foward
  1370.  
  1371.                    bra     FindStartTools             ;error in configfile
  1372.  
  1373. AppXPosLoop2
  1374.                    addq.l  #1,a0
  1375.                    addq.l  #1,a3
  1376.                    cmp.b   #0,(a0)
  1377.                    beq     CFGInitError               ;error in configfile
  1378.  
  1379.                    move.b  (a0),d0
  1380.                    move.b  (a3),d3
  1381.                    cmp.b   d0,d3
  1382.                    bne.s   FindAppXPos
  1383.                    cmp.b   #':',(a3)
  1384.                    bne.s   AppXPosLoop2
  1385.  
  1386. AppXEqual
  1387.                    addq.l  #1,a0
  1388.                    cmp.b   #'=',(a0)                  ;find = charcter
  1389.                    beq.s   AppXEqualEnd
  1390.                    cmp.b   #' ',(a0)                  ;only space pleace (if not =)
  1391.                    beq.s   AppXEqual
  1392.  
  1393.                    bra     CFGInitError               ;error in configfile
  1394.  
  1395. AppXEqualEnd
  1396.                    addq.l  #1,a0
  1397.                    cmp.b   #0,(a0)                    ;är file slut?
  1398.                    beq     CFGInitError               ;error in configfile
  1399.  
  1400.                    cmp.b   #' ',(a0)                  ;leta upp början
  1401.                    beq.s   AppXEqualEnd
  1402.  
  1403. GetXPos
  1404.                    moveq   #0,d1
  1405.                    move.l  d1,APPICONX
  1406. XPosLoop           move.b  (a0)+,d1                   ;läs tecken från arglist
  1407.                    cmp.b   #' ',d1                    ;slut på tecken?
  1408.                    beq.s   EndFindAppXPos             ;Ja hopp till loop
  1409.                    cmp.b   #10,d1                     ;slut på tecken?
  1410.                    beq.s   EndFindAppXPos             ;Ja hopp till loop
  1411.                    cmp.b   #0,d1                      ;är arglista slut ?
  1412.                    beq     CFGInitError               ;error in configfile
  1413.                    move.l  APPICONX,d0                ;hämta tidigare tal
  1414.                    move.l  d1,d3
  1415.                    moveq   #10,d1
  1416.                    bsr     Mulu3232                   ;Multipl. two longwords
  1417.                    move.l  d3,d1
  1418.                    move.l d0,APPICONX                 ;spara multiplicerat tal
  1419.                    bsr    ASCIIHex                    ;omvandla tecken till tal
  1420.                    add.l  d1,APPICONX                 ;addera och spara talet
  1421.                    bra.s  XPosLoop                    ;hopp till loop
  1422. EndFindAppXPos
  1423.                    move.l  EndOFUIface(pc),a0         ;get pointer config-memory
  1424.  
  1425. FindAppYPos        lea     APPY,a3                    ;get pointer to Y: string
  1426.  
  1427. AppYPosLoop1
  1428.                    move.b  (a0),d0
  1429.                    move.b  (a3),d3
  1430.                    cmp.b   d0,d3                      ;Y=Y?
  1431.                    beq.s   AppYPosLoop2               ;yes check rest of argument
  1432.                    cmp.b   #0,(a0)+                   ;No! end of config?
  1433.                    bne.s   AppYPosLoop1               ;no, check if found foward
  1434.  
  1435.                    bra.s   FindStartTools             ;error in configfile
  1436.  
  1437. AppYPosLoop2
  1438.                    addq.l  #1,a0
  1439.                    addq.l  #1,a3
  1440.                    cmp.b   #0,(a0)
  1441.                    beq     CFGInitError               ;error in configfile
  1442.  
  1443.                    move.b  (a0),d0
  1444.                    move.b  (a3),d3
  1445.                    cmp.b   d0,d3
  1446.                    bne.s   FindAppYPos
  1447.                    cmp.b   #':',(a3)
  1448.                    bne.s   AppYPosLoop2
  1449.  
  1450. AppYEqual
  1451.                    addq.l  #1,a0
  1452.                    cmp.b   #'=',(a0)                  ;find = charcter
  1453.                    beq.s   AppYEqualEnd
  1454.                    cmp.b   #' ',(a0)                  ;only space pleace (if not =)
  1455.                    beq.s   AppYEqual
  1456.  
  1457.                    bra     CFGInitError               ;error in configfile
  1458.  
  1459. AppYEqualEnd
  1460.                    addq.l  #1,a0
  1461.                    cmp.b   #0,(a0)                    ;är file slut?
  1462.                    beq     CFGInitError               ;error in configfile
  1463.  
  1464.                    cmp.b   #' ',(a0)                  ;leta upp början
  1465.                    beq.s   AppYEqualEnd
  1466.  
  1467. GetYPos
  1468.                    moveq   #0,d1
  1469.                    move.l  d1,APPICONY
  1470. YPosLoop           move.b  (a0)+,d1                   ;läs tecken från arglist
  1471.                    cmp.b   #' ',d1                    ;slut på tecken?
  1472.                    beq.s   EndFindAppYPos             ;Ja hopp till loop
  1473.                    cmp.b   #10,d1                     ;slut på tecken?
  1474.                    beq.s   EndFindAppYPos             ;Ja hopp till loop
  1475.                    cmp.b   #0,d1                      ;är arglista slut ?
  1476.                    beq     CFGInitError               ;error in configfile
  1477.                    move.l  APPICONY,d0                ;hämta tidigare tal
  1478.                    move.l  d1,d3
  1479.                    moveq   #10,d1
  1480.                    bsr     Mulu3232                   ;multipl. to longwords
  1481.                    move.l  d3,d1
  1482.                    move.l  d0,APPICONY                ;spara multiplicerat tal
  1483.                    bsr     ASCIIHex                   ;omvandla tecken till tal
  1484.                    add.l   d1,APPICONY                ;addera och spara talet
  1485.                    bra.s   YPosLoop                   ;hopp till loop
  1486. EndFindAppYPos
  1487.                    bra.s   FSTools
  1488.  
  1489. ;  ***********
  1490. FindStartTools
  1491.                    move.l  EndOFUIface(pc),a0         ;get pointer config-memory
  1492. FSTools            lea     TOOLSSTRING,a3             ;get pointer to TOOLS: string
  1493.  
  1494. FStartTLoop
  1495.                    move.b  (a0),d0
  1496.                    move.b  (a3),d3
  1497.                    cmp.b   d0,d3                      ;T=T?
  1498.                    beq.s   FStartTool2                ;yes check rest of argument
  1499.  
  1500.                    cmp.b   #0,(a0)+                   ;No! end of config?
  1501.                    bne.s   FStartTLoop                ;no, check if found foward
  1502.  
  1503.                    bra     CFGInitError               ;error in configfile
  1504.  
  1505. FStartTool2
  1506.                    addq.l  #1,a0
  1507.                    addq.l  #1,a3
  1508.                    cmp.b   #0,(a0)
  1509.                    beq.s   CFGInitError               ;error in configfile
  1510.  
  1511.                    move.b  (a0),d0
  1512.                    move.b  (a3),d3
  1513.                    cmp.b   d0,d3
  1514.                    bne.s   FSTools
  1515.                    cmp.b   #10,(a3)
  1516.                    bne.s   FStartTool2
  1517.                    addq.l  #1,a0
  1518.                    move.l  a0,StartOFTools
  1519.  
  1520. FindEndTools
  1521.                    move.l  StartOFTools(pc),a0        ;get pointer StartTools block
  1522. FETools            lea     FILESTRING,a3              ;get pointer to FILENAME: string
  1523.  
  1524. FEndTLoop
  1525.                    move.b  (a0),d0
  1526.                    move.b  (a3),d3
  1527.                    cmp.b   d0,d3                      ;F=F?
  1528.                    beq.s   FEndTool2                  ;ja kolla mer
  1529.  
  1530.                    cmp.b   #0,(a0)+                   ;Nej slut config?
  1531.                    bne.s   FEndTLoop                  ;nej kolla nästa
  1532.  
  1533.                    bra.s   CFGInitError               ;fel i configfile
  1534.                                              ;här kankse man kunde Sätta EndOFTools
  1535. FEndTool2
  1536.                    move.l  a0,a5                    ;kom ihåg EnfOFTools
  1537.                    subq    #1,a5
  1538.  
  1539. FEndTool3          addq.l  #1,a0
  1540.                    addq.l  #1,a3
  1541.                    cmp.b   #0,(a0)
  1542.                    beq.s   CFGInitError               ;error in configfile
  1543.                    move.b  (a0),d0
  1544.                    move.b  (a3),d3
  1545.                    cmp.b   d0,d3
  1546.                    bne.s   FETools
  1547.                    cmp.b   #10,(a3)
  1548.                    bne.s   FEndTool3
  1549.                    addq.l  #1,a0
  1550.                    move.l  a5,EndOFTools
  1551.                    move.l  a0,StartOFFiles
  1552.  
  1553.  
  1554. ;  OBS                                   **; om TOOLTYPE: skall in så måste detta ändras!
  1555.                    move.l  ConfigMem(pc),a0           ;get pointer starttools block
  1556.                    add.l   FileLen,a0
  1557.                    move.l  a0,EndOFFiles
  1558.  
  1559.                    move.l  #1,RetCode1
  1560.                    rts
  1561.  
  1562. CFGInitError2
  1563.                    bsr.s   FreeDiskObj
  1564.                    bsr     CfgErrMSG
  1565.                    bra     Cleanup
  1566. CFGInitError
  1567.                    bsr     CfgErrMSG
  1568.                    move.l  #0,RetCode1
  1569.                    rts
  1570.  
  1571. INTERFACESTRING    dc.b    'APPICON:',10,0
  1572.                    even
  1573. APPX               dc.b    'X:',10,0
  1574.                    even
  1575. APPY               dc.b    'Y:',10,0
  1576.                    even
  1577. TOOLSSTRING        dc.b    'TOOLS:',10,0
  1578.                    even
  1579. FILESTRING         dc.b    'FILENAME:',10,0
  1580.                    even
  1581. TOOLTYPESTRING     dc.b    'TOOLTYPE:',10,0
  1582.                    even
  1583. ******************************************************************************
  1584. *****                        *************************************************
  1585. *****    FREE DISK OBJECT    *************************************************
  1586. *****                        *************************************************
  1587. ******************************************************************************
  1588.  
  1589. FreeDiskObj
  1590.                    move.l  IconBase(pc),a6
  1591.                    move.l  Diskobj,a0
  1592.                    cmp.l   #0,a0
  1593.                    beq.s   EndFreeDiskObj
  1594.                    jsr     _FreeDiskObject(a6)
  1595. EndFreeDiskObj
  1596.                    rts
  1597.  
  1598. ******************************************************************************
  1599. *******                               ****************************************
  1600. *******   OPEN CONFIG FILE FROM DISK  ****************************************
  1601. *******                               ****************************************
  1602. ******************************************************************************
  1603.  
  1604. OpenCfgFile
  1605.                    move.l  #CFGName1,d1               ;get filename
  1606.                    bsr     LockFile
  1607.                    cmp.l   #0,d0
  1608.                    beq.s   Opf2                       ;Error in open try next path
  1609.  
  1610.                    move.l  #CFGName1,d1               ;get filename
  1611.                    bsr     OpenFile
  1612.                    cmp.l   #0,d0
  1613.                    beq     Cleanup                    ;can lock but not open=error quit
  1614.                    bra.s   EndCfgOpen
  1615. Opf2:
  1616.  
  1617.                    lea     (CFGName1).l,a0            ;get filename
  1618.                    move.b  #'/',1(a0)                 ;chane path
  1619.                    move.l  a0,d1                      ;get new path of filename
  1620.  
  1621.                    move.l  #CFGName1,d1               ;get filename
  1622.                    bsr.s   LockFile
  1623.                    cmp.l   #0,d0
  1624.                    beq.s   Opf3                       ;Error in open try next path
  1625.  
  1626.                    move.l  #CFGName1,d1               ;get filename
  1627.                    bsr     OpenFile
  1628.                    cmp.l   #0,d0
  1629.                    beq     Cleanup                    ;can lock but not open=error quit
  1630.                    bra.s   EndCfgOpen
  1631. Opf3:
  1632.                    move.l  #CFGName2,d1               ;get filename
  1633.                    bsr.s   LockFile
  1634.                    cmp.l   #0,d0
  1635.                    beq     OpenCfgErrMSG
  1636.  
  1637.                    move.l  #CFGName2,d1               ;get filename
  1638.                    bsr     OpenFile
  1639.                    cmp.l   #0,d0
  1640.                    beq     Cleanup                    ;can lock but not open=error quit
  1641. EndCfgOpen
  1642.  
  1643.                    move.l  (ExecBase).w,a6
  1644.                    move.l  FileLen,d0                 ;request filelen bytes of mem
  1645.                    move.l  #MEMF_ANY_CLEAR,d1         ;any type of mem.
  1646.                    jsr     _AllocMem(a6)              ;AllocMem
  1647.                    move.l  d0,ConfigMem               ;save pointer to our mem
  1648.                    bne.s   Readcfg
  1649.  
  1650.                    bsr.s   CloseCfgFile
  1651.                    bsr.s   UnLockFile
  1652.                    bsr     NoMemMSG                   ;print text to CLI-window
  1653.                    bra     Cleanup                    ;no memory. Exit
  1654.  
  1655. Readcfg            bsr.s   ReadCfgFile
  1656.                    bsr.s   CloseCfgFile
  1657.                    bsr.s   UnLockFile
  1658.  
  1659.                    rts
  1660.  
  1661. ***************************************************************************************
  1662.  
  1663. LockFile
  1664.                    move.l  DosBase(pc),a6             ;get DOS base
  1665.                    moveq.l #SHARED_LOCK,d2            ;read only
  1666.                    jsr     _Lock(a6)                  ;lock the file
  1667.                    move.l  d0,MyFileLock              ;remember the lock
  1668.                    beq.s   EndLockFile                ;problem to lock!
  1669.                    move.l  d0,d1
  1670.  
  1671.                    move.l  FileInfoMem(pc),d2         ;pointer to FileInfoBlock mem
  1672.                    jsr     _Examine(a6)
  1673.                    tst.l   d0                         ;ok?
  1674.                    beq     Cleanup                    ;no ??????
  1675.                    move.l  FileInfoMem(pc),a0         ;adressen till FileInfoBlock
  1676.                    add.l   #fib_Size,a0               ;offset to filelen
  1677.                    move.l  (a0),FileLen               ;save the length of file in bytes
  1678.  
  1679.                    moveq   #1,d0
  1680. EndLockFile
  1681.                    rts
  1682.  
  1683. ******************************************************************************
  1684.  
  1685. UnLockFile
  1686.                    move.l  DosBase(pc),a6
  1687.                    move.l  MyFileLock,d1              ;get filelockpointer.
  1688.                    jsr     _UnLock(a6)                ;relese lock.
  1689.                    move.l  #0,MyFileLock              ;clear pointer.
  1690.                    rts
  1691.  
  1692. ******************************************************************************
  1693.  
  1694. OpenFile
  1695.                    move.l  #MODE_OLDFILE,d2           ;read only
  1696.                    jsr     _Open(a6)                  ;Open file
  1697.                    move.l  d0,CfgFile                 ;save pointer to file
  1698.  
  1699. EndOpenFile
  1700.                    rts
  1701.  
  1702. ******************************************************************************
  1703.  
  1704. CloseCfgFile
  1705.                    move.l  DosBase(pc),a6             ;get DOS base
  1706.                    move.l  CfgFile,d1                 ;get filepointer
  1707.                    jsr     _Close(a6)                 ;Open file
  1708.                    rts
  1709.  
  1710. ******************************************************************************
  1711.  
  1712. ReadCfgFile
  1713.  
  1714.                    move.l  DosBase(pc),a6             ;get DOS base
  1715.                    move.l  CfgFile,d1                 ;get filepointer
  1716.                    move.l  ConfigMem(pc),d2           ;adressen till FileInfoBlock
  1717.                    move.l  FileLen,d3
  1718.                    jsr     _Read(a6)                  ;Open file
  1719.                    beq     Cleanup                    ;Error in Close  ??????
  1720.                    bsr     INITCONFIG                 ;mark Start/end TOOLS & FILES
  1721.                    rts
  1722.  
  1723.  
  1724. ******************************************************************************
  1725.  
  1726. PointTOCLI:
  1727.                    move.l  DosBase(pc),a6             ;doslibrary pekare till
  1728.                    tst.l   (WBTRUE).l                 ;koll om Start WB el CLI?
  1729.                    bne.s   PointTOWB                  ;om WB hopp
  1730.                    jsr     _Output(a6)                ;hämta output pekare till Dos!
  1731.                    move.l  d0,CLIpoint                ;Spara undan pekaren
  1732. PointTOWB:
  1733.                    rts
  1734.  
  1735. *****************************************************************************
  1736. *********                                ************************************
  1737. *********   ADDAPPICON / REMOVEAPPICON   ************************************
  1738. *********                                ************************************
  1739. *****************************************************************************
  1740.  
  1741. AddAppIcon
  1742.  
  1743.                    move.l  StartOFUIface,a0
  1744.                    move.l  IconBase(pc),a6
  1745.                    jsr     _GetDiskObject(a6)         ;get diskobject
  1746.                    move.l  d0,AppDiskOBJ              ;Save diskobjectet pointer
  1747.                    beq.s   EndAddAppIcon
  1748.  
  1749.                    move.l  AppDiskOBJ(pc),a3          ;Pekare till Diskobjstrukt
  1750.                    move.l  APPICONX,do_CurrentX(a3)
  1751.                    move.l  APPICONY,do_CurrentY(a3)
  1752.  
  1753.                    move.l  WBBase(pc),a6               Hämta workbenchBase
  1754.                    moveq   #1,d0                       ID#
  1755.                    moveq   #64,d1                      se i autodoc WB.doc (2.0)
  1756.                    sub.l   a2,a2
  1757.                    sub.l   a4,a4
  1758.                    move.l  MyPort(pc),a1
  1759.                    lea     AppIconTxt(pc),a0          ;Pekare till texten
  1760.                    move.l  AppDiskOBJ(pc),a3          ;Pekare till Diskobjstrukt
  1761.                    jsr     _AddAppIconA(a6)           ;lägg till under toolmeny ny Item
  1762.                    move.l  d0,AppIconHandle           ;Spara AppIcon hanteraren
  1763. EndAddAppIcon
  1764.                    rts
  1765.  
  1766. AppIconTxt         dc.b    'NewDefTool',0
  1767.                    even
  1768.  
  1769. ;****************************************************************************
  1770.  
  1771. RemAppIcon
  1772.                    move.l  WBBase(pc),a6              ;Get Workbench-base
  1773.                    move.l  AppIconHandle(pc),a0       ;get handler
  1774.                    cmp.l   #0,(a0)
  1775.                    beq.s   RemAppICont
  1776.                    jsr     _RemoveAppIcon(a6)         ;Remove AppIcon
  1777. RemAppICont
  1778.  
  1779.                    move.l  IconBase(pc),a6            ;Free read diskobj (icon)
  1780.                    move.l  AppDiskOBJ,a0              ;Free Diskobj get by GetDiskObj()
  1781.                    cmp.l   #0,(a0)
  1782.                    beq.s    EndRemAppIcon
  1783.                    jsr     _FreeDiskObject(a6)
  1784. EndRemAppIcon
  1785.                    rts
  1786.  
  1787. *****************************************************************************
  1788. *********                             ***************************************
  1789. *********   CREATEPORT / DELETEPORT   ***************************************
  1790. *********                             ***************************************
  1791. *****************************************************************************
  1792.  
  1793. CreatePort
  1794.                    move.l  (ExecBase).w,a6             ;Laddar Execbase
  1795.                    moveq   #-1,d0
  1796.                    jsr     _AllocSignal(a6)
  1797.                    cmp.b   #-1,d0
  1798.                    beq.s   Crt_Err
  1799.                    move.l  d0,sigbit
  1800.  
  1801.                    moveq   #34,d0                      längden på messagestrukturen
  1802.                    move.l  #MEMF_TYPE,d1               public-mem + clear
  1803.                    jsr     _AllocMem(a6)                allokera minne
  1804.                    bne.s   CreateCount
  1805.                    move.l  sigbit(pc),d0
  1806.                    jsr     _FreeSignal(a6)
  1807. Crt_Err            moveq   #0,d0
  1808.                    rts
  1809.  
  1810. CreateCount
  1811.                    move.l  d0,MyPort                   Spara adressen till minne/MSGstrukturen
  1812.                    move.l  d0,a4                       samt till a4
  1813.                    move.b  #NT_MSGPORT,LN_TYPE(a4)    ;sturcture Node
  1814.                    move.b  pri(pc),LN_PRI(a4)         ;prioriteten
  1815.                    move.l  #PortName,LN_NAME(a4)      ;adressen till namnet
  1816.                    move.b  #PA_SIGNAL,MP_FLAGS(a4)
  1817.                    sub.l   a1,a1
  1818.                    jsr     _FindTask(a6)               hitta vårt task
  1819.                    move.l  d0,MP_SIGTASK(a4)           spara det
  1820.                    move.l  MyPort(pc),a1               adressen till MSGstrukturen
  1821.                    jsr     _AddPort(a6)                lägg till porten
  1822.                    move.l  MyPort(pc),d0
  1823. EndCreatePort      rts
  1824.  
  1825. ******************************************************************************
  1826.  
  1827. DeletePort
  1828.                    move.l  (ExecBase).w,a6             ;Ladda Execbase
  1829.                    move.l  MyPort(pc),a4               ;portsturkturen
  1830.                    move.l  MyPort(pc),a1
  1831.                    jsr     _RemPort(a6)                 avlägnsa porten
  1832.  
  1833.   ;* OBS Dessa två rader råder det tvivel om Det skiljer sig mellan RKM och
  1834.   ;  Amiga System programer's guide. 
  1835.  
  1836.                    move.l  #-1,MP_SIGTASK(a4)         ;Enligt RKM manualen.
  1837.                    move.l  #$FF,(a4)                   Enligt Amiga System prog. guide
  1838.  
  1839.                    move.l  #-1,MP_MSGLIST(a4)
  1840.                    moveq   #0,d0
  1841.                    move.b  MP_SIGBIT(a0),d0
  1842.                    jsr     _FreeSignal(a6)
  1843.                    move.l  MyPort(pc),a1               adressen till minnet vi allokerade
  1844.                    moveq   #34,d0                      antal allokerade byte
  1845.                    jsr     _FreeMem(a6)                 frigör minnet.
  1846.  
  1847.  
  1848. EndDelPort
  1849.                    rts
  1850.  
  1851. ****************************************************************************
  1852. *****                                ***************************************
  1853. *****     BORDERDRAW BORDER TEXT     ***************************************
  1854. *****                                ***************************************
  1855. ****************************************************************************
  1856.  
  1857. DisplayFlash:                                         ;*Visar en flash i skärmen a0
  1858.                    move.l IntBase(pc),a6              ;basadressen till intuition i a6
  1859.                    sub.l  a0,a0                       ;skärmens hanterare i a0
  1860.                    jsr    _DisplayBeep(a6)            ;Flash
  1861.                    rts
  1862.  
  1863. ****************************************************************************
  1864. *****                                      *********************************
  1865. *****    EasyRequest on error              *********************************
  1866. *****                                      *********************************
  1867. ****************************************************************************
  1868. Request                                         ;in a1<== EasyStructure
  1869.                    move.l  IntBase(pc),a6
  1870.                    sub.l   a0,a0
  1871.                    sub.l   a2,a2
  1872.                    sub.l   a3,a3
  1873.                    jsr     _EasyRequestArgs(a6)
  1874.                    rts
  1875.  
  1876. ****************************************************************************
  1877. *****                                      *********************************
  1878. *****    ASCII->Hex Convert AscII to Hex   *********************************
  1879. *****                                      *********************************
  1880. ****************************************************************************
  1881.  
  1882.  
  1883.               ;ASCII to hex. Converts one character.
  1884.               ;Requires (character ASCII) (d1)
  1885.               ;Returns  (converted value) (d1)
  1886.  
  1887. ASCIIHex:
  1888.                    sub.b  #'A',d1                     ;Subtract $41
  1889.                    bcc.s  InsertChar                  ;Branch if A =< d0 =< F.
  1890.                    addq.b #7,d1                       ;Else correct d0.
  1891. InsertChar:
  1892.                    add.b  #10,d1                      ;And add 10.
  1893.                    rts                                ;Ready.
  1894.  
  1895. ****************************************************************************
  1896. *****                                      *********************************
  1897. *****    MULU3232                          *********************************
  1898. *****                                      *********************************
  1899. ****************************************************************************
  1900.  
  1901. Mulu3232:     ;32*32-bit unsigned multiply
  1902.               ;Operation d0*d1 => d0 , 32*32=>32
  1903.               ;Source operands:
  1904.               ;d0 = ULONG
  1905.               ;d1 = ULONG
  1906.               ;Result:
  1907.               ;d0 = ULONG
  1908.               ;d1 = UBYTE, set if overflow, otherwise cleared
  1909.  
  1910.               move.l   d2,-(sp)
  1911.               moveq    #0,d2
  1912. Mulu3232_a:
  1913.               lsr.l    #1,d0
  1914.               bcc.s    Mulu3232_b
  1915.               add.l    d1,d2
  1916.               bvs.s    Mulu3232_Done
  1917. Mulu3232_b:
  1918.               add.l    d1,d1
  1919.               tst.l    d0
  1920.               bne.s    Mulu3232_a
  1921. Mulu3232_Done:
  1922.               svs      d1
  1923.               move.l   d2,d0
  1924.               move.l   (sp)+,d2
  1925.               rts
  1926.  
  1927. *****************************************************************************
  1928. *********                  **************************************************
  1929. *********   DATA  / Text   **************************************************
  1930. *********                  **************************************************
  1931. *****************************************************************************
  1932.  
  1933. InfoStr:           dc.b    '.info',0
  1934.  
  1935. DosName:           dc.b    'dos.library',0
  1936.                    even
  1937. IconName:          dc.b    'icon.library',0
  1938.                    even
  1939. IntName:           dc.b    'intuition.library',0
  1940.                    even
  1941. AslName:           dc.b    'asl.library',0
  1942.                    even
  1943. WBName:            dc.b    'workbench.library',0
  1944.                    even
  1945. PortName:          dc.b    'NDT_Port',0
  1946.                    even
  1947. SText1:            dc.b    10,'NewDefTool V1.01 © Copyright by Kjell'
  1948.                    dc.b    ' Cederfeldt 1992 ',10,10
  1949. SText1E:           even
  1950.  
  1951. HText1:
  1952.                    dc.b    ' Programmed in 100% Assembler by Kjell Cederfeldt in'
  1953.                    dc.b    ' Jan 1992',10,' This is Public Domain',10,10
  1954.                    dc.b    'Usage: NewDefTool <file|dir> [file|dir]..',10,10
  1955. HText1E:           even
  1956.  
  1957. EText:
  1958.                    dc.b    'Bad arguments, Usage "NewDefTool -?" for help',10,10,10
  1959. ETextE:            even
  1960.  
  1961. E2Text:
  1962.                    dc.b    'Bad arguments or filename',10,10,10
  1963. E2TextE:           even
  1964.  
  1965. FoundStr:
  1966.                    dc.b    10,'Found tool... '
  1967. EFoundStr:         even
  1968.  
  1969. ChangeStr:
  1970.                    dc.b    10,'changed to... '
  1971. EChangeStr:        even
  1972.  
  1973. Txt1:              dc.b    'NewDefaultTool V1.01',0
  1974.                    even
  1975.  
  1976. EASYStruct         dc.l    20  ;Len of structure
  1977.                    dc.l    0
  1978.                    dc.l    EasyTitle
  1979. EASYText           dc.l    EasyCFGERRText
  1980.                    dc.l    EasyABORT
  1981. EndEasyStruct      dc.l    0
  1982.  
  1983. EasyTitle          dc.b    'NewDefTool Error Request',0
  1984.                    even
  1985. EasyCFGERRText     dc.b    "Error found in NewDefaultTool configurationfile.",10
  1986.                    dc.b    "Refer to the manual.",0
  1987.                    even
  1988. EasyMEMERRText     dc.b    "Insufficient memory SORRY!.",0
  1989.                    even
  1990. EasyAPPERRText     dc.b    "Can't find AppIcon on requested path",0
  1991.                    even
  1992. EasyOpenCFGERRText dc.b    "Can't find configurationfile",10
  1993.                    dc.b    "Refer to the manual.",0
  1994.                    even
  1995. EasyABORT          dc.b    "ABORT",0
  1996.                    even
  1997.  
  1998. EASYStruct2        dc.l    20  ;Len of structure
  1999.                    dc.l    0
  2000.                    dc.l    Txt1
  2001. EASYText2          dc.l    EasyTextstr
  2002.                    dc.l    EasyHIDEQUIT
  2003. EndEasyStruct2     dc.l    0
  2004.  
  2005. EasyHIDEQUIT       dc.b    "HIDE|QUIT",0
  2006.                    even
  2007.  
  2008. EasyTextstr        dc.b    'NewDefaultTool © Copyright 1992',10
  2009.                    dc.b    'by Kjell Cederfeldt',10,10
  2010.                    dc.b    'This program is in the Public Domain.',10
  2011.                    dc.b    'It may be freely distributed for',10
  2012.                    dc.b    'non-commercial purposes only.',0
  2013. EndEasyTextSrt     even
  2014.  
  2015. NewMessage:        dc.l    0
  2016. DosBase:           dc.l    0
  2017. IconBase:          dc.l    0
  2018. AslBase:           dc.l    0
  2019. IntBase:           dc.l    0
  2020. FileReq:           dc.l    0
  2021. disklib_base:      dc.l    0
  2022. WBBase:            dc.l    0
  2023. CLIpoint:          dc.l    0
  2024. FileMem:           dc.l    0
  2025. FileInfoMem:       dc.l    0
  2026. ConfigMem:         dc.l    0
  2027. MyPort:            dc.l    0
  2028. AppDiskOBJ:        dc.l    0
  2029. AppIconHandle:     dc.l    0
  2030. sigbit:            dc.l    0
  2031. MysigBit:          dc.l    0
  2032. FoundPort          dc.l    0
  2033. AppMsgStruct       dc.l    0
  2034. FileArpMem:        dc.l    0
  2035. EntryMem:          dc.l    0
  2036. Diskobj:           dc.l    0
  2037. FileLen:           dc.l    0
  2038. MyFileLock:        dc.l    0
  2039. OldLock:           dc.l    0
  2040. CfgFile:           dc.l    0
  2041. NewDefTool:        dc.l    0
  2042. CopyDefTool:       dc.l    0
  2043. StartOFUIface:     dc.l    0
  2044. EndOFUIface:       dc.l    0
  2045. StartOFTools:      dc.l    0
  2046. EndOFTools:        dc.l    0
  2047. StartOFFiles:      dc.l    0
  2048. EndOFFiles:        dc.l    0
  2049. APPICONX:          dc.l    0      ;X-position for AppIcon
  2050. APPICONY:          dc.l    0      ;Y-position for AppIcon
  2051. DirEntryType:      dc.l    0    ;> 0 = Directory,  < 0 = File.
  2052. RetCode1           dc.l    0    ;avgör om ett anrop lyckats/misslyckats.
  2053. MatchOK:           dc.w    0    ;0= no match of string found, 1= match string found
  2054. CLIMORE:           dc.w    0    ;0= no more names from cli's arglist 1= there are more
  2055. AskTrue:           dc.w    0    ;0= no ask-requester, 1= ask-requester
  2056. APPICONTRUE:       dc.w    0    ;0= no AppIcon, 1= AppIcon
  2057. pri:               dc.b    0
  2058.                    even
  2059. VersionTag         dc.b    0,'$VER: NewDefaultTool V1.01 (92-01-01)'
  2060.                    dc.b    ' © Copyright by Kjell Cederfeldt 1992',10,0
  2061.                    even
  2062. Feed:              dc.b    10
  2063.                    even
  2064.                    end
  2065.  
  2066. *********************************************************************************
  2067. *****                                ********************************************
  2068. *****   COMMENTS  /  FREE TEXTFORM   ********************************************
  2069. *****                                ********************************************
  2070. *********************************************************************************
  2071. I denna version:
  2072.  
  2073. * Till så att det går att skriva enbart ? för hjälptext (men -? -h fungerar också)
  2074.  
  2075. * Ny testutskrifts Found tool... xxxxxxxxx Change tool.... xxxxxxxxxx har lagts
  2076.   till och ser bra ut.
  2077.  
  2078. * 0.32-0.33 Klart uppbettrad cli-hantering. Bort med #? el. * för att hitta
  2079.   currentdir. för att byta alla i currentdir skrivs ""
  2080.  
  2081. * Förbättrad feltexthantering i CLI!
  2082.  
  2083. * Byte via filnamna (FILENAME:) är äntligen klart och fungerar, dock verkar det
  2084.   problem via CLI (men den biten skall ju få ett rejält lyft nu innan den släpps)
  2085.   FILNAME: har högsta prioriteten, därefter (om inte match) tools:
  2086.  
  2087. * 0.30 update! Bugg fixad, En reply glömdes bort vid AppUserWin så dubbelklicken,
  2088.   besvardes aldrig.
  2089.  
  2090. * 0.30 Fixat så att [TAB] godkännes i konfigurationsfilen. Error-requester om
  2091.   konfigurationsfilen inte hittas, samt om inte AppIconen hittas.
  2092.   Det kommer inte upp någon Appicon om man kör från CLI (även om man anger detta)
  2093.   (Möjligen skall NDT känna av om det finns en Workbench screen = OpenPubScreen()
  2094.    och om det finns lägga ut en Appicon om detta är konfigurerat, annars ASL'req.
  2095.  
  2096. * 0.29 Bytte ut "fönstret" mot EasyRequester istället, samt lagt till en del error-
  2097.   requesters
  2098.  
  2099. * X & Y position fixades i 0.27
  2100.  
  2101. * Ändrat så att programmet inte avslutar då man släpper en AppIcon eller en icon
  2102.   som intr har en fil. (Se direkt efter CheckFileDir i HandlesFile)
  2103.  
  2104. * Tagit bort en allvarlig bugg i AllocMoreEntrys rutinen (plats för fler filnamn om
  2105.   de 512 inte skulle räcka) i AllocmoreEntrys görs en ny CheckFileDir (den bör inte
  2106.   misslyckas) det finns ingen bra koll på rutinen misslyckas.
  2107.  
  2108. * Bytit ut arp's wildcardsrutiner mot Commodores. (* ej längre godkänd som wildcard)
  2109.  
  2110. * Blikar till (DisplayBeep) varje gång programmet får ett meddelande då fönstret är
  2111.   öppet.
  2112.  
  2113. * Tar emot meddelanden även då föstret är öppet (från AppIcone och andra Tasks)
  2114.  
  2115. * Föster som öppnads när man klickar på Appiconen.
  2116.  
  2117. * Tillägg av nytt keyword i config-filen (APPICON) en AppIcon öppnas om detta är
  2118.   valt dock kan inget ifrån den hanteras ännu. Namnet till iconen sparas men
  2119.   används inte heller ännu.
  2120.  
  2121. * ARP & REQ filerequester är borttagna helt!
  2122.  
  2123. * Helt ny wildcard rutin för Old/New defaultTool. Nu används arp's rutiner för att
  2124.   avgöra om strängarna matchar varandra. Allt ser ut att fungera bra.
  2125.  
  2126. * Det fungerar att ange path och filnamn från CLI. Vill man byta alla i CurrentDir
  2127.   så går det att skriva * el. #? men det går inte att använda WildCard i överigt.
  2128.  
  2129. * Sökning i flera rader fungerar bra.
  2130.   Dock borde inte fler radsrutinen ställa till med problem, när de andra wildcard
  2131.   rutinerna blir klara. (fungerar bra även för den utan wildcards)
  2132.  
  2133. FIXA:
  2134.  
  2135. * Bör kolla att newdeftool och olddeftool inte är samma så den byts i onödan (även
  2136.   om olddeftool uppfyller enligt konfigfilen ex: *more i konfigfilen, står Sys:
  2137.   Utilities/More i iconen och destsidan i konfigfilen. Enklet att fixa ?
  2138.   ---> Kommentar till ovan. Detta borde gå att lösa med WildCardrutinerna.
  2139.        Dessutom bör det gå ifall man vill byta till "RÄTT" Case i iconen.
  2140.  
  2141. * Om det är mellan rum i filnamnet till Appcion i configfilen bör detta kunna
  2142.   hanteras med fnuttar. Knulla är skönt!
  2143.  
  2144. * Om det är mellanrum i strängen så måste min match-rutin klara fnuttar och namnet.
  2145.  
  2146. * Om  man skiver filnamnet från CLI med olika Case mot vad filen har så råkar den
  2147.   sparas med det Case som skrivs från CLI
  2148.  
  2149. * Om det är mellanrum i filnamet så klara inte argumet-rutine för CLI det.
  2150.  
  2151. * Det vore bra om filnamnsrutinen kunde klara Wildcards också.
  2152.  
  2153.  
  2154. ** Tag bort utskrift av tooltypes (eller fixa till bättre) i GetDefTool funktionen.
  2155.  
  2156.  
  2157. IDEER:
  2158.  
  2159. * Man skall kunna lägga till ASK sist (först??) på raden i config-file för att
  2160.   en requester skall komma upp och fråga om strängen AAAA skall bytas mot BBBB
  2161.   (YES = utför det bytet, NO utför inte, ALL utför byte på alla projekt.iconer.
  2162.  
  2163. * Kanske man kan vilja lägga till standard tool-type rader vid byte av default-
  2164.   tool? se nedan:
  2165.  
  2166.  
  2167. APPICON: = ram:TFD-T
  2168. TOOLS:
  2169. *MutchMore  Sys:Utilities/More
  2170. #?DPaint    Work:Nytto/Grafik/DPaint/DPaint
  2171. #?:ced      Sys:Utilities/ED
  2172. FILENAME:
  2173. ReadMe#?    Sys:Utilities/More
  2174. Read.Me#?   Sys:Utilities/More
  2175. #?.s        Sys:Utilities/Ed
  2176. TOOLTYPE:
  2177. 1COLOR=4
  2178. 2COLOR=8
  2179. 3SCREEN=CUSTOM
  2180. 4SCREEN=WORKBECH
  2181. 5INTERLACE=YES
  2182. 6INTERLACE=NO
  2183.  
  2184. **********************************************************************************
  2185.